# Contributor: Pedro Filipe <xpecex@outlook.com>
# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Maintainer: ScrumpyJack <scrumpyjack@st.ilet.to>
pkgname=opencpn
pkgver=4.8.8
pkgrel=3
pkgdesc="OpenCPN is a cross platform electronic navigation system"
url="http://opencpn.org"
arch="x86 x86_64 aarch64"
license="GPL-2.0"
makedepends="wxgtk-dev libexecinfo-dev linux-headers curl-dev cmake gpsd portaudio-dev tinyxml-dev"
subpackages="$pkgname-doc $pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/OpenCPN/OpenCPN/archive/v$pkgver.tar.gz
	CMakeList.txt.patch
	CMakeList-wxWidgets.patch
	Replace-some-wx-arrays-with-std-vector.patch
	compile-without-wxUSE_XLOCALE.patch
	opencpn_alpine_aarch64.patch
	"

builddir="$srcdir/OpenCPN-$pkgver"

build() {
	export CFLAGS="-fcommon" # FIXME
	cmake -DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUNDLE_GSHHS=CRUDE \
		-DBUNDLE_TCDATA=ON \
		-DEXTRA_LIBS="-lexecinfo" \
		-DBUNDLE_DOCS=ON
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="4fa94655d7b9d389f5f335c15898e7138c792c71b824720fedd762ccd71c01481e5a24598b85211dba0c7d89d0ad0b2ebc2afc38301235829d4aa6f499c6f9b2  opencpn-4.8.8.tar.gz
a42f9f416abebeeaba4f73c96dc4b8e981dc453354978656e8da9964d5df278665db41ed715e90badeee995ac6066656bddba1ff428d5f218edc8115d881c05b  CMakeList.txt.patch
34d17ee1e01eceb79702c642bdfb392178633525aca059c07bc424691aaafb5252d56c4c3b9d42d7273f6663f33b1a18ee653964274b790cf6bd2ab6e57a8635  CMakeList-wxWidgets.patch
882577101e4ef767ce11c5bad34f5d7a9cecdf0f764bcfaf54ebf840d9aebceeef2947c42c794af31747af6d688e328f410cefea513662875aef5cbea76c5b1d  Replace-some-wx-arrays-with-std-vector.patch
83ef403b7b5b7e9d44d87aabedce84923241092d32e2905f01566287dd99cac72fd60060c34d81022c4b9c064ff7707fdfdebe24f9a1260301f3f1d886650acb  compile-without-wxUSE_XLOCALE.patch
9e86b98634b8d873a4766956d0bd8d91d5bdddbd2b260cd0982dbe117687a32bd37d18095bb5b314491cb6490941352e7ad9f54ebc4d37b86a7b5c543d506712  opencpn_alpine_aarch64.patch"
